package cn.HK.controller;

import cn.HK.po.Emp;
import cn.HK.service.CheckService;
import cn.HK.vo.SystemResult;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

@RestController
@RequestMapping("/emp")
public class CheckController {
    @Autowired
    private CheckService checkService;

    @RequestMapping("/checkName")
    public SystemResult CheckEmpName(String eName){
       Boolean exist= checkService.checkUsername(eName);
       if (exist){
           return SystemResult.ok();
       }else {
           return SystemResult.build(201,"员工名字已存在",null);
       }
    }
}
